$OpenBSD: patch-editor_c,v 1.2 2004/03/06 02:41:00 naddy Exp $
--- editor.c.orig	1996-11-22 02:28:46.000000000 +0100
+++ editor.c	2004-03-06 01:55:49.000000000 +0100
@@ -213,7 +213,7 @@ static void DoLoadLevel(display, window)
 
     /* Construct the Edit level filename */
     if ((str = getenv("XBOING_LEVELS_DIR")) != NULL)
-        sprintf(levelPath, "%s/editor.data", str);
+        snprintf(levelPath, sizeof(levelPath), "%s/editor.data", str);
     else
         sprintf(levelPath, "%s/editor.data", LEVEL_INSTALL_DIR);
 
@@ -652,9 +652,15 @@ static void SetupPlayTest(display)
     Display *display;
 #endif
 {
+	int fd;
+
 	EditState = EDIT_TEST;
 
-	strcpy(tempName, tempnam("/tmp", "xboing-"));
+	sprintf(tempName, "/tmp/xboing-XXXXXXXXXX");
+	if ((fd = mkstemp(tempName)) < 0)
+	  ShutDown(display, 1, "Sorry, cannot save test play level.");
+
+	close(fd);
   	if (SaveLevelDataFile(display, tempName) == False)
    		ShutDown(display, 1, "Sorry, cannot save test play level.");
 
@@ -957,9 +963,9 @@ static void LoadALevel(display)
     num = atoi(str);
     if ((num > 0) && (num <= MAX_NUM_LEVELS))
     {
-	    /* Construct the Edit level filename */
-   	 	if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
-        	sprintf(levelPath, "%s/level%02ld.data", str2, (u_long) num);
+	/* Construct the Edit level filename */
+   	if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
+        	snprintf(levelPath, sizeof(levelPath), "%s/level%02ld.data", str2, (u_long) num);
     	else
         	sprintf(levelPath, "%s/level%02ld.data", 
 				LEVEL_INSTALL_DIR, (u_long) num);
@@ -1017,9 +1023,9 @@ static void SaveALevel(display)
     num = atoi(str);
     if ((num > 0) && (num <= MAX_NUM_LEVELS))
     {
-	    /* Construct the Edit level filename */
-   	 	if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
-        	sprintf(levelPath, "%s/level%02ld.data", str2, (u_long) num);
+	/* Construct the Edit level filename */
+   	if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
+        	snprintf(levelPath, sizeof(levelPath), "%s/level%02ld.data", str2, (u_long) num);
     	else
         	sprintf(levelPath, "%s/level%02ld.data", 
 				LEVEL_INSTALL_DIR, (u_long) num);
